#ifndef _CAN_DRIVER_H_
#define _CAN_DRIVER_H_

#include "can.h"

/**
 * \brief CAN发送管理结构体 
 */
typedef struct 
{
	CAN_HandleTypeDef*   hcan;     //CAN总线标识(hcan1 ro hcan2)               
	uint32_t  stdid;    //CAN总线标识符            
	uint8_t   data[8];  //CAN通信帧待发送数据
}CANTransmitStruct;


/**
 * \brief CAN邮箱发送
 * \param[in] hcan CAN总线控制句柄
 * \param[in] std_id 目标节点标识符 
 * \param[in] aData 数据缓冲数组
 */ 
void CANTransmit_U8(CAN_HandleTypeDef *hcan, uint32_t std_id, uint8_t aData[]);

/**
 * \brief CAN邮箱发送，发送数据以uint16_t为单位
 * \param[in] hcan CAN总线控制句柄
 * \param[in] std_id 目标节点标识符 
 * \param[in] uint16_t data1 data2 data3 data4
 */ 
void CANTransmit_I16(CAN_HandleTypeDef *hcan, uint32_t std_id, int16_t output1, int16_t output2, int16_t output3, int16_t output4);

/**
 * \brief CAN邮箱发送，发送数据以uint16_t为单位
 * \param[in] hcan CAN总线控制句柄
 * \param[in] std_id 目标节点标识符 
 * \param[in] uint16_t data1 data2 data3 data4
 */ 
void CANTransmit_I16(CAN_HandleTypeDef *hcan, uint32_t std_id, int16_t output1, int16_t output2, int16_t output3, int16_t output4);

/**
 * \brief CAN初始化启动,配置滤波器
 * \param[in] hcan CAN总线控制句柄
 */
 
void CANInitialize(CAN_HandleTypeDef *hcan);

/**
 * \brief 使能CAN接收等待中断
 * \param[in] hcan CAN总线控制句柄 
 */
void CANReceiveEnable(CAN_HandleTypeDef *hcan);

#endif
